package org.easydarwin.easyplayer.zhi;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.github.czy1121.view.RoundButton;


import org.easydarwin.easyplayer.R;
import org.easydarwin.http.SpfUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * 设置IP
 */
public class SetIp_Activity extends AppCompatActivity {

    @BindView(R.id.img_back)
    RelativeLayout imgBack;
    @BindView(R.id.textView4)
    TextView textView4;
    @BindView(R.id.qs)
    RoundButton qs;
    @BindView(R.id.sjrxx)
    TextView sjrxx;
    @BindView(R.id.ed_mz)
    EditText edMz;

    @BindView(R.id.teacher)
    TextView teacher;
    @BindView(R.id.ed_teacher)
    EditText edTeacher;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_kvxx_);
        ButterKnife.bind(this);

        String ip = (String) SpfUtils.get(SetIp_Activity.this, "ip", "192.168.43.1");
        edMz.setText(ip);
    }

    @OnClick({R.id.img_back, R.id.qs})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.qs:
                String s = edMz.getText().toString();




                if (TextUtils.isEmpty(s)) {
                    Toast.makeText(this, "请输入IP", Toast.LENGTH_SHORT).show();
                    return;

                }
                SpfUtils.put(SetIp_Activity.this, "ip", edMz.getText().toString());


                finish();
                break;
        }
    }
}
